import api from '@/utlis/api.js';
import { baseUrl } from '@/utlis/api.js';

//=======oss=======
//文件下载链接
export const fileUrl = baseUrl + "app/oss/download/";
//文件上传
export const uploadFile = (data) => {
	return new Promise((resolve, reject) => {
		api("", "FILE", data).then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		});
	});
}
//查看文件信息
export const fileDetail = (fileId) => {
	return new Promise((resolve, reject) => {
		api("app/oss/listByIds/" + fileId, "GET").then(res => {
			resolve(res.data)
		}).catch(err => {
			reject(err);
		});
	});
}

//=======用户=======
//获取用户信息
export const userInfo = () => {
	return new Promise((resolve, reject) => {
		api("app/getInfo", "GET").then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		});
	});
}

//修改用户信息
export const editUser = (data) => {
	return new Promise((resolve, reject) => {
		api("app/user/userBase/", "PUT", data).then(res => {
			resolve(res.data)
		}).catch(err => {
			reject(err);
		});
	});
}

//=======任务=======

//=======论坛=======